package com.honesty.svn;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends Activity {
	private ListView lv_main;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();
    }
    public void init(){
    	setContentView(R.layout.activity_main);
    	lv_main = (ListView)findViewById(R.id.lv_main);
    	ListAdapter listAdapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1, getData());
    	lv_main.setAdapter(listAdapter);
    	lv_main.setOnItemClickListener(onItemClickListener);
    }
    
    OnItemClickListener onItemClickListener = new OnItemClickListener() {
    	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
			switch (arg2) {
			case 0:
				Toast.makeText(MainActivity.this, "popupview", Toast.LENGTH_SHORT).show();
				break;
			}
		}
	};
	
	private List<String> getData(){
		List<String> data = new ArrayList<String>();
        data.add("popupView");
        data.add("popupView2");
        return data;
	}

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}
